class Employee{
    constructor(name,typeCode){
        this._name = name;
        this._typeCode = typeCode;
    }

    get name(){
        return this._name;
    }
    get type(){
        return Employee.legalTypeCodes[this._typeCode];
    }

    static get legalTypeCodes(){
        return {"E":"Engineer", "M":"Manager","S":"Salesman"};
    }
}
// 调用者
candidate = new Employee(document.name, document.empType);
const leadEngineer = new Employee(document.leadEngineer,"E");
/**************************************************************** */
class Employee{
    constructor(name,typeCode){
        this._name = name;
        this._typeCode = typeCode;
    }

    get name(){
        return this._name;
    }
    get type(){
        return Employee.legalTypeCodes[this._typeCode];
    }

    static get legalTypeCodes(){
        return {"E":"Engineer", "M":"Manager","S":"Salesman"};
    }
}

function createEmployee(name, typeCode){
    return new Employee(name, typeCode);
}
// 调用者
candidate = createEmployee(document.name, document.empType);
const leadEngineer2 = createEmployee(document.leadEngineer,"E");

const leadEngineer3 = createEngineer(document.leadEngineer);
function createEngineer(name){
    return new Employee(name,"E");
}